package com.mmall.concurrency.example.singleton;

public class SingletonExample7 {
    private SingletonExample7(){
    }

    public static SingletonExample7 getInstance(){
        return Singleton.INSTANCE.getInstance();
    }

    public enum  Singleton{
        INSTANCE;
        private  SingletonExample7 instance=null;
        //jvm只会执行一次
        Singleton(){
            instance= new SingletonExample7();
        }

        public SingletonExample7 getInstance(){
            return  instance;
        }
    }

}
